﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QFlow.Core
{
    public static class Accounting
    {
        private static double[] _Values;
        public static double PurchaseCredit { get; set; }
        public static double SalesCredit { get; set; }
        public static double PurchaseReturn { get; set; }
        public static double SalesReturn { get; set; }

        /// <summary>
        /// Save the current values.
        /// </summary>
        public static void SaveCurrentValues()
        {
            _Values = new double[4];
            _Values[0] = PurchaseCredit;
            _Values[1] = SalesCredit;
            _Values[2] = PurchaseReturn;
            _Values[3] = SalesReturn;
        }

        /// <summary>
        /// Restor the accouting values.
        /// </summary>
        public static void RestorValues()
        {
            if (_Values != null)
            {
                PurchaseCredit = _Values[0];
                SalesCredit = _Values[1];
                PurchaseReturn = _Values[2];
                SalesReturn = _Values[3];
            }
        }

        //Commit the new values.
        public static void CommitCurentValues()
        {
            _Values = null;
        }
    }
}
